package com.joesem.sale.client.widget.dialog

import android.content.Context
import android.view.LayoutInflater
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.jiaxing.sale.client.databinding.DialogImgTypeBinding
import com.joesem.sale.client.utils.click


fun picDialog(context: Context, pic: () -> Unit, camera: () -> Unit) {
    BottomSheetDialog(context).apply {
        val bind = DialogImgTypeBinding.inflate(LayoutInflater.from(context))
        bind.btnCancel.click { dismiss() }
        bind.btnCamera.click {
            camera.invoke()
            dismiss()
        }
        bind.btnPic.click {
            pic.invoke()
            dismiss()
        }
        setContentView(bind.root)
    }.show()
}